/**
 * ifuner 制作 @18658226071@163.com
 * 用来配置当前的接口请求的地址
 */
"use strict"
import utils from "./utils/util"

let currentEnv = "prod"
let localUrl = "http://192.168.2.9:9005"
try {
  const value = wx.getStorageSync("envSettings")
  if (value && utils.isObj(value)) {
    console.log("使用的环境变量", value.currentEnv)
    currentEnv = value.currentEnv
    value.ipAddress && (localUrl = value.ipAddress)
  }
} catch (e) {
  console.log(e)
}

module.exports = {
  env: currentEnv,
  version: "3.0.0",
  allEnv: ["local", "dev", "test", "prod"],
  // java 相关API
  mock: false, // 是否开启mock 针对全局并且只有local 有效
  dingding: false, // 尽量只在本地开发开启
  // 登录白名单页面
  LOGIN_WHITE_LIST: [
    "pages/DemoA/DemoA",
    "pages/DemoB/DemoB",
    "pages/my/my",
  ],
  defaultToken: {
    "local": "e480c643.6a67a60de66736725aecf4a3bc3e3360a241aed6",
    "dev": "e480c643.6a67a60de66736725aecf4a3bc3e3360a241aed6",
    "test": "e480c643.6a67a60de66736725aecf4a3bc3e3360a241aed6",
    "prod": "e480c643.6a67a60de66736725aecf4a3bc3e3360a241aed6"
  }[currentEnv],
  miniEnvVersion: {
    "local": "develop",
    "dev": "trial",
    "test": "trial",
    "prod": "release" // 正式版
    // "prod": "trial", // 临时体验版
  }[currentEnv],
  apiHost: {
    local: localUrl,
    dev: "https://bjmpdev.kaiheikeji.com",
    test: "https://bjmptest.kaiheikeji.com",
    prod: "https://bjmpprod.kaiheikeji.com"
  }[currentEnv],
  // python 相关APi
  apiPythonHost: {
    local: "https://dev.kaiheikeji.com",
    dev: "https://dev.kaiheikeji.com",
    test: "https://te2.kaiheikeji.com",
    // prod:"https://kh-grey-jks.bjdj.kaiheikeji.com",
    prod: "https://bjdj.kaiheikeji.com"
  }[currentEnv],
  rongImAppKey: {
    local: "p5tvi9dspjp74",
    dev: "p5tvi9dspjp74",
    test: "p5tvi9dspjp74",
    prod: "n19jmcy5ndn29"
  }[currentEnv],
  // 神策埋点上报
  saUploadUrl: {
    local: "https://kh-sa-data.kaiheikeji.com/sa?project=default",
    dev: "https://kh-sa-data.kaiheikeji.com/sa?project=default",
    test: "https://kh-sa-data.kaiheikeji.com/sa?project=default",
    prod: "https://kh-sa-data.kaiheikeji.com/sa?project=production"
  }[currentEnv]
}
